<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js多态</title>
</head>
<body>
<script>
    function polymorphism(val1, val2, val3, val4) {
        if (arguments.length === 1) {
            console.log('the first style: ' + val1)
        } else if (arguments.length === 2) {
            console.log('the second style: ' + val1 + ', ' + val2)
        } else if (arguments.length === 3) {
            console.log('the third style: ' + val1 + ', ' + val2 + ', ' + val3)
        } else {
            console.log('the fourth style: ' + val1 + ', ' + val2 + ', ' + val3 + ', ' + val4)
        }
    }
    polymorphism('one')
    polymorphism('one', 'two')
    polymorphism('one', 'two', 'three')
    polymorphism('one', 'two', 'three', 'four')
</script>
</body>
</html>